Add `no_term` test that ensures correct output when a
authorMike Boutin <mike.boutin@gmail.com>
Tue, 4 Aug 2015 01:11:34 +0000 (21:11 -0400)
committerMike Boutin <mike.boutin@gmail.com>
Tue, 4 Aug 2015 23:03:00 +0000 (19:03 -0400)
`TerminfoTerminal` cannot be created.

tests/test_shell.rs

index d3ee5f591b239a760dc8d0c77f3ed518f9e078a2..a91e18c53f7496a758f50855dd567251f3453430 100644 (file)
@@ -28,7 +28,18 @@ test!(non_tty {
     Shell::create(Box::new(Sink(a.clone())), config).tap(|shell| {
         shell.say("Hey Alex", color::RED).unwrap();
     });
+    let buf = a.lock().unwrap().clone();
+    assert_that(&buf[..], shell_writes("Hey Alex\n"));
+});
 
+test!(no_term {
+    let config = ShellConfig { color_config: Always, tty: false };
+    let a = Arc::new(Mutex::new(Vec::new()));
+
+    ::std::env::remove_var("TERM");
+    Shell::create(Box::new(Sink(a.clone())), config).tap(|shell| {
+        shell.say("Hey Alex", color::RED).unwrap();
+    });
     let buf = a.lock().unwrap().clone();
     assert_that(&buf[..], shell_writes("Hey Alex\n"));
 });